﻿namespace EFS.RC.CC.CH.Entities.Surveys
{
	public class SurveyInfo : EFS.Common.Serialization.ISerializable
	{
		/// DO NOT CHANGE VALUES (binded to DB)
		public enum eType
		{
			[EFS.Common.StringValue("Conversation")]
			Conversation = 0,

			[EFS.Common.StringValue("Document")]
			Document = 1
		}

		/// DO NOT CHANGE VALUES (binded to DB)
		public enum eReviewType
		{
			[EFS.Common.StringValue("Agent")]
			Agent = 0,

			[EFS.Common.StringValue("Customer")]
			Customer = 1
		}

		public System.Int32? ID { get; set; }
		public System.String Name { get; set; }
		public System.String IsTemplate { get; set; }
		public eType? Type { get; set; }
		public eReviewType? ReviewType { get; set; }

		/// Property TypeName: Get
		public System.String TypeName
		{
			get
			{
				if (Type.HasValue)
				{
					EFS.Common.StringEnum stringEnum = new EFS.Common.StringEnum(typeof(eType));
					return stringEnum.GetStringValue(Type.Value.ToString());
				}
				return "";
			}
		}

		/// Property ReviewTypeName: Get
		public System.String ReviewTypeName
		{
			get
			{
				if (ReviewType.HasValue)
				{
					EFS.Common.StringEnum stringEnum = new EFS.Common.StringEnum(typeof(eReviewType));
					return stringEnum.GetStringValue(ReviewType.Value.ToString());
				}
				return "";
			}
		}

		/// Serialize
		public void Serialize(EFS.Common.Serialization.XmlWriter xmlWriter)
		{
			// write
			xmlWriter.Write("ID", ID);
			xmlWriter.Write("Name", Name);
			xmlWriter.Write("IsTemplate", IsTemplate);

			// Type
			System.Int32? nType = null;
			if (Type.HasValue)
			{
				nType = (System.Int32)Type.Value;
			}
			xmlWriter.Write("Type", nType);

			// ReviewType
			System.Int32? nReviewType = null;
			if (ReviewType.HasValue)
			{
				nReviewType = (System.Int32)ReviewType.Value;
			}
			xmlWriter.Write("ReviewType", nReviewType);
		}

		/// Deserialize
		public void Deserialize(EFS.Common.Serialization.XmlReader xmlReader)
		{
			// read
			ID = xmlReader.ReadInt32("ID");
			Name = xmlReader.Read("Name");
			IsTemplate = xmlReader.Read("IsTemplate");

			// ReviewType
			System.Int32? nType = xmlReader.ReadInt32("Type");
			Type = null;
			if (nType.HasValue)
			{
				Type = (eType)(nType.Value);
			}

			// ReviewType
			System.Int32? nReviewType = xmlReader.ReadInt32("ReviewType");
			ReviewType = null;
			if (nReviewType.HasValue)
			{
				ReviewType = (eReviewType)(nReviewType.Value);
			}
		}
	}

}